|
|
 |
|
|
|
|
' Set picResult's pixels. SetBitmapPixels picResult, bits_per_pixel, pixels
picResult.Picture = picResult.Image
End Sub |
|
|
|
|
|
|
|
|
Program BinCont uses pixel brightness to decide which pixels to make black and which to make white. There are many other ways a program might make this decision. Example program BinCont2, shown in Figure 6.9, examines only one of each pixel's color components. When you click on a component histogram, the program uses the value you clicked as the cutoff value for that component. For example, if you click the value 127 in the middle of the green component histogram (in the middle), the program makes pixels with green color components of 127 or more white. |
|
|
|
|
|
|
|
|
Program BinCont2 uses the following code to set the image's pixel values. The value Index indicates which component to test and is 0 for red, 1 for green, and 2 for blue. |
|
|
|
 |
|
|
|
|
With pixels(X, Y)
Select Case Index
Case 0
test_value = .rgbRed
Case 1
test_value = .rgbGreen
Case 2
test_value = .rgbBlue
End Select
If test_value >= cutoff Then
.rgbRed = 255
.rgbGreen = 255 |
|
|
|
|
|
|
|
|
Figure 6.9
Program BinCont2 examines a single color component to
decide which pixels to make black and which to make white. |
|
|
|
|
|